package com.gz.steak.utils.format;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author 刘牌
 * @Date 2020/3/6 0006 23:36
 * @Version 1.0
 */

public class DateFormat {
    public static String dateToString(Date date){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String s = simpleDateFormat.format(date);
        return s;
    }

    public static Date formatDate(Date date){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String s = simpleDateFormat.format(date);
        Date date1 = null;
        try {
            date1 = simpleDateFormat.parse(s);
        }catch (Exception e){
            e.printStackTrace();
        }
        return date1;
    }


}
